{
    // this

    let obj = {
        name: 'ws'
    };
    
    function fn () {
        console.log(this.name);
    }
    
    fn.call(obj); // -> 'ws'

}

{

    // call apply bind

    let obj = {
        title: 'News'
    };

    function gn (para='nothing') {
        console.log(this.title,para);
    }

    gn.call(obj);
    gn.bind(obj)();
    gn.call(obj,'something');
    gn.apply(obj,['something']);

}

{
    // 箭头函数

    let a = 10;

    let obj = {
        a: 1000,
        func1: function () {
            console.log(this.a);
        },
        func2: function () {
            let _this = this;
            setTimeout(function () {  // 注意 箭头函数内部没有 this ，它的this是箭头函数最外部函数所处作用域的this
                console.log(_this.a);
            }, 1000);
        }
    };
    obj.func1();
    obj.func2();
    console.log('a',obj.a);

}


